﻿// Copyright: 2012
// Author: Minh Vu - YoungJ
// File: FeedSource.cs - PhoneAppRssReader - PhoneAppRssReader
// Time: 7:38 AM 04/18/2012

using System.Collections.Generic;
using System.Collections.ObjectModel;
using PhoneAppRssReader.Utls;

namespace PhoneAppRssReader.Entity
{
    public class FeedSource
    {
        public FeedSource()
        {
            Items = new ObservableCollection<Feed>();
        }
        public void LoadData()
        {
            IsDataLoad = true;
            var list = XmlAction.Read();
            if (list == null) return;

            foreach (var feed in list)
            {
                Items.Add(new Feed { Id = feed.Id, Title = feed.Title, Url = feed.Url });
            }
        }

        public static ObservableCollection<Feed> GetSampleDataRss()
        {
            var list = new ObservableCollection<Feed>
                           {
                               new Feed
                                   {
                                       Title = "Tinh tế",
                                       Url = "http://tinhte.vn/rss"
                                   },
                               new Feed
                                   {
                                       Title = "HD Việt Nam",
                                       Url =
                                           "http://www.hdvietnam.com/diendan/external.php?do=rss&type=newcontent&sectionid=1&days=120&count=10"
                                   },
                               new Feed
                                   {
                                       Title = "Phần mềm - HD Việt Nam",
                                       Url =
                                           "http://www.hdvietnam.com/diendan/external.php?do=rss&type=newcontent&sectionid=2478&days=120&count=10"
                                   },
                               new Feed
                                   {
                                       Title = "Vi Tính - VNexpress",
                                       Url = "http://vnexpress.net/rss/gl/vi-tinh.rss"
                                   },
                               new Feed
                                   {
                                       Title = "Vi tính - Dân Trí",
                                       Url = "http://dantri.com.vn/vitinh.rss"
                                   },
                               new Feed
                                   {
                                       Title = "V0Z Express",
                                       Url = "http://voz.vn/muc/tin/feed/atom/"
                                   },
                               new Feed
                                   {
                                       Title = "Nhịp sống số - Tuổi Trẻ",
                                       Url = "http://tuoitre.vn/RssFeeds.aspx?ChannelID=16"
                                   },
                               new Feed
                                   {
                                       Title = "Lưu trữ và truyền tải - HD Việt Nam",
                                       Url =
                                           "http://www.hdvietnam.com/diendan/external.php?do=rss&type=newcontent&sectionid=364&days=120&count=10"
                                   },
                               new Feed
                                   {
                                       Title = "Facebook Notifications",
                                       Url =
                                           "http://www.facebook.com/feeds/notifications.php?id=100000415479516&viewer=100000415479516&key=AWiRX90n9PtzeV9f&format=rss20"
                                   }
                           };
            return list;
        }

        public ObservableCollection<Feed> Items { get; private set; }
        public bool IsDataLoad { get;  set; }


    }
}